<template>
  <el-popconfirm
    :title="title"
    @confirm="confirm"
    @cancel="cancel"
    popper-class="_ehl_confirm"
    :hide-icon="true"
    :confirm-button-text="confirmButtonText"
    :cancel-button-text="cancelButtonText"
  >
    <template slot="reference">
      <slot />
    </template>
  </el-popconfirm>
</template>
<script>
  import Vue from 'vue'
  import { Popconfirm } from 'element-ui'
  Vue.use(Popconfirm)
  export default {
    props: {
      title: { type: String, default: () => '标题' },
      data: { type: Object, default: () => {} },
      confirmButtonText: { type: String, default: () => '确定' },
      cancelButtonText: { type: String, default: () => '取消' },
    },
    methods: {
      confirm() {
        this.$emit('confirm', this.data)
      },
      cancel() {
        this.$emit('cancel', this.data)
      },
    },
  }
</script>
